package gate;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import protobuf.ParseRegistryMap;
import protobuf.generate.cli2srv.login.Login;

import java.io.IOException;

/**
 * Created by tianfei on 2017/4/17.
 */
public class TransferHandlerMap {

    static Logger logger= LoggerFactory.getLogger(TransferHandlerMap.class);

    //注册所有的处理消息转发的Handler
    public static void initRegistry() throws IOException {


        logger.info("initRegistry Handler");

        //fixme 初期服务器只做推送功能，不向Logic发送聊天消息，而且鉴权也在gate上做，所以gate不需要转发,所以只填充用户登录消息
        //fixme 跳入ClientMessager::transfer2Auth做修改，让消息转发给Auth服务器
        ClientMessager.registerTranferHandler(ParseRegistryMap.CLOGIN, ClientMessager::transfer2Auth, Login.CLogin.class);
        //ClientMessager.registerTranferHandler(1001, ClientMessager::transfer2Auth, Auth.CRegister.class);
        //ClientMessager.registerTranferHandler(ParseRegistryMap.SPUSH, ClientMessager::transfer2Logic, Chat.CPrivateChat.class);
    }
}
